import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChatConfigVO, ChatConfigForm, ChatConfigQuery } from '@/api/business/chatConfig/types';

/**
 * 查询ai system 设定列表
 * @param query
 * @returns {*}
 */

export const listChatConfig = (query?: ChatConfigQuery): AxiosPromise<ChatConfigVO[]> => {
  return request({
    url: '/business/chatConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询ai system 设定详细
 * @param aiChatId
 */
export const getChatConfig = (aiChatId: string | number): AxiosPromise<ChatConfigVO> => {
  return request({
    url: '/business/chatConfig/' + aiChatId,
    method: 'get'
  });
};

/**
 * 新增ai system 设定
 * @param data
 */
export const addChatConfig = (data: ChatConfigForm) => {
  return request({
    url: '/business/chatConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改ai system 设定
 * @param data
 */
export const updateChatConfig = (data: ChatConfigForm) => {
  return request({
    url: '/business/chatConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除ai system 设定
 * @param aiChatId
 */
export const delChatConfig = (aiChatId: string | number | Array<string | number>) => {
  return request({
    url: '/business/chatConfig/' + aiChatId,
    method: 'delete'
  });
};
